package com.retail.order.service.impl;

import com.retail.order.entity.vo.AdminVerifyDetailOrderVo;
import com.retail.core.entity.ParamReq;
import com.retail.order.entity.request.AdminVerifyDetailOrderRequest;
import com.retail.order.mapper.AdminVerifyDetailOrderMapper;
import com.retail.order.service.AdminVerifyDetailOrderService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
* 订单核销明细 Service impl
* @author Administrator
*/
@Service
public class AdminVerifyDetailOrderServiceImpl implements AdminVerifyDetailOrderService {

   @Resource
   private AdminVerifyDetailOrderMapper adminVerifyDetailOrderMapper;

   @Override
   public AdminVerifyDetailOrderVo getModel(Long id) {
      return  adminVerifyDetailOrderMapper.getModel(id);
   }

   @Transactional
   @Override
   public Long save(AdminVerifyDetailOrderRequest adminVerifyDetailOrderRequest) {
      adminVerifyDetailOrderMapper.save(adminVerifyDetailOrderRequest);
      return adminVerifyDetailOrderRequest.getId();
   }

   @Transactional
   @Override
   public Long update(AdminVerifyDetailOrderRequest adminVerifyDetailOrderRequest) {
      adminVerifyDetailOrderMapper.update(adminVerifyDetailOrderRequest);
      return adminVerifyDetailOrderRequest.getId();
   }

   @Override
   public List<AdminVerifyDetailOrderVo> listPage(ParamReq<AdminVerifyDetailOrderRequest> params) {
      params.setStartIndex((params.getCurrent() -1 ) * params.getSize());
      return adminVerifyDetailOrderMapper.listPage(params);
   }

   @Override
   public Integer countPage(ParamReq<AdminVerifyDetailOrderRequest> params) {
       return adminVerifyDetailOrderMapper.countPage(params);
   }

   @Override
   public Integer updateDelFlagById(Long id, Integer delFlag) {
       return adminVerifyDetailOrderMapper.updateDelFlagById(id, delFlag);
   }
}
